<div class="main-content">
	<header>
		<a href="<?php echo bu('admin/banners/new'); ?>" class="fr button button-gray">Add Banners</a>
		<h2>Edit Banner</h2>
	</header>

	<section>
		<?php
      $form = $this->beginWidget('CActiveForm', array(
        'id' => 'form',
        'action' => bu('admin/banners/update'),
        'htmlOptions' => array(
          'class' => 'form',
          'method' => 'POST',
          'enctype' => 'multipart/form-data',
        ),
      ));
    ?>
      <div style="text-align:center">
        <?php 
            $file_type = explode('.', $banner->image);
            $count = count($file_type);
            if($file_type[$count-1] == 'swf'){ 			
            list($width, $height, $type, $attr) = getimagesize(Yii::getPathOfAlias('webroot')."/assets/banners/".$banner->image);
          ?>
            <EMBED src="<?php echo bu("assets/banners/".$banner->image); ?>" quality=high NAME="Yourfilename" width='<?php echo $width; ?>' height='<?php echo $height; ?>' ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>
          <?php }else{ ?>
            <img style="max-width:500px;" src ="<?php echo bu("assets/banners/".$banner->image); ?>" />
          <?php } ?>
      </div><br />
			<fieldset>
				<legend>Please insert your banners info</legend>
				<label>Name <em>*</em></label>
        <?php echo $form->textField($banner, 'name', array('required' => 'required')); ?>
        <?php echo $form->error($banner, "name"); ?>

        <label>URL <em>*</em></label>
        <?php echo $form->textField($banner, 'url', array('required' => 'required')); ?>
        <?php echo $form->error($banner, "url"); ?>

				<label>Change Banner Image
        <small>Please insert image file only! (JPG/PNG/GIF)</small></label>
				<?php echo CHtml::activeFileField($banner, 'upload'); ?>

        <input type="hidden" name="Banners[id]" value="<?php echo $_GET['id'] ?>" />

				<div class="action">
						<button class="button button-gray" type="submit"><span class="accept"></span>OK</button>
						<button class="button button-gray" type="reset">Reset</button>
				</div>
			</fieldset>
    <?php $this->endWidget(); ?>
	</section>
</div>